<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="de.pernpas.calendar.common.CalUtils"%>
<%@page import="de.pernpas.calendar.Navigator" %>

<html>
<head>
<link type="text/css" rel="stylesheet" href="/css/stylesheet.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"">
<title>Neuen Eintrag</title>
</head>
<body>

	<div class="marked contentContainer"> Neuen Eintrag</div>
	<%
	String dateStr = "";
	if(request.getParameter("year") != null && !request.getParameter("year").equals("") &&
			request.getParameter("month") != null && !request.getParameter("month").equals("") &&
			request.getParameter("day") != null && !request.getParameter("day").equals("")){
		int month = Integer.parseInt(request.getParameter("month")) + 1;
		String monthString = "";
		if(month < 10) {
			monthString = "0" + month;
		}else{
			monthString = "" + month;
		}
		dateStr = request.getParameter("day") + "." +
					monthString + "." +	request.getParameter("year");
	}
	%>
	<form action="/createEvent">
		<div class="contentContainer">
			<div>
				<span class="eventAttributName">Datum:</span>
				<input type="text" name="date" value="<%= dateStr %>"></input>
				<span>(dd.mm.yyyy)</span>
			</div>
			<div>
				<span class="eventAttributName">Name: </span>
				<input type="text" name="name"></input>
			</div>
			<div>
				<span class="eventAttributName">Ort: </span> 
				<input type="text" name="location">	</input>
			</div>
			<div>
				<span class="eventAttributName">Beschreibung: </span> 
				<textarea rows="10" cols="50" name="description"></textarea>
			</div>			
			<div class="buttonContainer">
				<input class="button" type="submit" value="Eintragen"></input>
				
				<%
				// Festlegen, wohin der Abbrechen Button füren soll
				String hrefStr = Navigator.getLink(request);
				%>
				<a class="button" href="<%= hrefStr %>">
					Abbrechen
				</a>
			</div>
			<input type="hidden" name="year" value="<%= request.getParameter("year") %>">
			<input type="hidden" name="month" value="<%= request.getParameter("month") %>">
			<input type="hidden" name="day" value="<%= request.getParameter("day") %>">
			<input type="hidden" name="fromPage" value="detail"></input>
		</div>
	</form>
</body>
</html>